import pygame
import sys
from init_map import InitMap


class Map(InitMap):
    def __init__(self, *args):
        InitMap.__init__(self)

        self.door_iron = pygame.image.load("../资源/图片/铁门.png").convert_alpha()
        self.ling_master = pygame.image.load("../资源/图片/灵法师.png").convert_alpha()
        self.prince_dark = pygame.image.load("../资源/图片/冥灵魔王.png").convert_alpha()

        self.hero_pos = (5, 5)
        self.up_pos = (5, 1)
        self.down_pos = (5, 7)
        self.variable_pos = {
            (4, 7): (self.door_iron, '墙'),
            (6, 7): (self.door_iron, '墙'),
            (5, 2): (self.ling_master, '灵法师_ss'),
            (5, 3): (self.ling_master, '灵法师_ss'),
            (5, 1): (self.prince_dark, '冥灵魔王_ss'),
        }

    def fixed_brick(self):
        self.draw(self.upstairs, self.up_pos[0], self.up_pos[1])
        self.dic[self.up_pos] = '上楼'
        self.draw(self.downstairs, self.down_pos[0], self.down_pos[1])
        self.dic[self.down_pos] = '下楼'
        for i in range(11):
            for j in [0, 8, 9, 10]:
                self.draw(self.wall, i, j)
                self.dic[(i, j)] = '墙'
        for j in range(7):
            self.draw(self.wall, 0, j + 1)
            self.dic[(0, j + 1)] = '墙'
            self.draw(self.wall, 10, j + 1)
            self.dic[(10, j + 1)] = '墙'
        for i in [(4, 1), (4, 2), (3, 2), (4, 3), (6, 1), (6, 2), (7, 2), (6, 3), (1, 1), (9, 1), (1, 4), (1, 5), (1, 6),
                  (1, 7), (9, 4), (9, 5), (9, 6), (9, 7), (2, 6), (2, 7), (8, 6), (8, 7), (3, 7), (7, 7), (5, 6)]:
            self.draw(self.wall, i[0], i[1])
            self.dic[(i[0], i[1])] = '墙'
        for i in self.ls:
            self.screen.blit(self.road, i)
            self.dic[(int((i[0]-375)/48), int((i[1]-25)/48))] = '路'
